{template '_header'}
<div class="page-heading">
	<span class="pull-right">
		{ifp 'messages.add'}
		<a class='btn btn-primary btn-sm' href="{php echo webUrl('messages/add')}"><i class="fa fa-plus"></i> 添加任务</a>
		{/if}
	</span>
	<h2>消息群发任务 <small>总数: {$total}</small></h2>
</div>

<form action="./index.php" method="get" class="form-horizontal" role="form">

	<div class="page-toolbar row m-b-sm m-t-sm">
		<div class="col-sm-6 pull-right">
			<div class="input-group">				 
				<input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="请输入关键词"> <span class="input-group-btn">

					<button class="btn btn-sm btn-primary" type="submit"> 搜索</button> </span>
			</div>
		</div>
	</div>
</form>

{if count($list)>0}

<form action="" method="post" >

	<table class="table table-hover table-responsive">
		<thead>
			<tr>
				<th>任务名称</th>
				<th >发送条数/未发送数/成功数/失败数</th>
				<th  >状态</th>
				<th style='width:420px;'>操作</th>
			</tr>
		</thead>
		<tbody>
			{loop $list $row}
			<tr>
				<td>{$row['title']}</td>
				<td>{$row['num']}/{$row['nosend']}/{$row['sendsuccess']}/{$row['sendfail']}</td>
				<td>{$row['statustext']}</td>

				<td>
					{ifp 'messages.run'}
					<a class='btn btn-default btn-sm'  data-toggle="ajaxRemove"  href="{php echo webUrl('messages/build', array('id' => $row['id']))}"><i class='fa fa-plus-circle'></i> 生成发送列表</a>
					{/if}
					{ifp 'messages.run'}
					<a class='btn btn-default btn-sm' href="{php echo webUrl('messages/run', array('id' => $row['id']))}"><i class='fa fa-qrcode'></i> 开始发送</a>
					{/if}
					{ifp 'messages.edit|messages.view'}
					<a class='btn btn-default btn-sm' data-toggle="ajaxRemove" href="{php echo webUrl('messages/reset', array('id' => $row['id']))}"><i class='fa fa-refresh'></i> 重置发送</a>
					{/if}
					{ifp 'messages.edit|messages.view'}
					<a class='btn btn-default btn-sm' href="{php echo webUrl('messages/edit', array( 'id' => $row['id']))}"><i class='fa fa-edit'></i> {ifp 'messages.edit'}编辑{else}查看{/if}</a>
					{/if}
					{ifp 'messages.delete'}
					<a class='btn btn-default btn-sm' data-toggle="ajaxRemove"  href="{php echo webUrl('messages/delete', array('id' => $row['id']))}"  title='删除' data-confirm="确认删除此任务吗？"><i class='fa fa-trash'></i> 删除</a>
					{/if}
				</td>
			</tr>
			{/loop}
		</tbody>
	</table>
	{$pager}    
	{else}
	<div class='panel panel-default'>
		<div class='panel-body' style='text-align: center;padding:30px;'>
			暂时没有任何任务!
		</div>
	</div>
	{/if}
</form> 

{template '_footer'}
